import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getCurrentUserInfo } from "@/api/user.js";

export const useUserStore = defineStore('userStore', () => {
  // 定义state
  const userInfo = ref({})
  const adminToken = ref()
  const clientToken = ref()
  // 定义action
  const getUserInfo = async () => {
    // 调接口获取用户信息
    // console.log(adminToken.value)
    // const res = await getCurrentUserInfo()
    // userInfo.value = res.data
    // console.log(userInfo.value)
  }
  // 以对象格式将state和action retuen 出去
  return { userInfo, adminToken,clientToken,getUserInfo }
},{ persist: true})